<?php
header("Content-Type: application/json; charset=UTF-8");
require_once 'db.php';

$sql = "SELECT * FROM fitness_guides WHERE status = 1 ORDER BY create_time DESC";
$result = $conn->query($sql);

$guides = [];
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $guides[] = $row;
    }
}

echo json_encode([
    'status' => 'success',
    'guides' => $guides
]);

$conn->close();
?> 